package com.fattyCorps.battle.controller;


import com.fattyCorps.battle.obj.msg.SRet;
import com.fattyCorps.battle.service.BattleService;
import com.fattyCorps.common.obj.msg.server.battle.CBattle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/battle")
public class BattleController {
    @Autowired
    BattleService battleService;



    @GetMapping("/test")
    public SRet test(HttpServletRequest request){
        return SRet.success(battleService.battleTest());
    }

    @PostMapping("/testPost")
    public SRet testPost(HttpServletRequest request){
        return SRet.success(battleService.battleTest());
    }

    @PostMapping("/battle")
    public SRet battle(HttpServletRequest request, @RequestBody CBattle msg){
        return SRet.success(battleService.battle(msg));
    }
}
